#include "Led.h"

#include "stm32f0xx_gpio.h"
#include "stm32f0xx_rcc.h"

void Led_Init(void)
{
    GPIO_InitTypeDef gpio;
    
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
    
    gpio.GPIO_Pin   = GPIO_Pin_8;
    gpio.GPIO_Mode  = GPIO_Mode_OUT;
    gpio.GPIO_OType = GPIO_OType_PP;
    gpio.GPIO_Speed = GPIO_Speed_50MHz;
    gpio.GPIO_PuPd  = GPIO_PuPd_UP;
    GPIO_Init(GPIOA,&gpio); 
    
    GPIOA->BSRR = GPIO_Pin_8;
}

void Led_Toggle(void)
{
    static char status = 0;
    
    if(status == 0)
    {
        status = 1;
        GPIOC->BSRR = GPIO_Pin_9;
    }
    else
    {
        status = 0;
        GPIOC->BRR = GPIO_Pin_9;
    }
}

// end of file -------------------

